jQuery.fn.compare = function(t) {
    if (this.length != t.length) {return false;}
    var a = this,
        b = t
    for (var i = 0; t[i]; i++) {
        if (a[i] !== b[i]) {
                return false;
        }
    }
    return true;
};

function var_dump(obj) {
   if(typeof obj == "object") {
      return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "")+"\nValue: " + obj;
   } else {
      return "Type: "+typeof(obj)+"\nValue: "+obj;
   }
}

function getFieldId(id){
    var string = id.split('-', 2);
    return string[1];
}

function createNewItem(){
    $.ajax({
    type: "GET",
    url: "./index.php?type=helper&action=createNewItem",
    contentType: "application/json; charset=utf-8",
    dataType: "json",
    cache: false,
    async: false, // to set local variable
    success: function(data) {
        $("a#ok").attr("href", "javascript:formUpdate()");
        $("input#itemId").val(data);
    }
});

}

function submitenter(e){
    var keycode;
    if (window.event) keycode = window.event.keyCode;
    else if (e) keycode = e.which;
    else return true;
    if (keycode == 13){
        signIn();
        return false;
    }
    else  return true;
}